package com.business_clean.ui.adapter.format;

import android.view.View;

import com.business_clean.R;
import com.business_clean.data.mode.format.FormatChildItemList;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class FormatAdapter extends BaseQuickAdapter<FormatChildItemList, BaseViewHolder> {

    private String id = "";

    public FormatAdapter() {
        super(R.layout.item_format);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, FormatChildItemList item) {
        holder.setText(R.id.tv_item_format_name, item.getCat_name());

        if (id.equals(item.getId())) {
            holder.getView(R.id.iv_item_format_select).setVisibility(View.VISIBLE);
        } else {
            holder.getView(R.id.iv_item_format_select).setVisibility(View.GONE);
        }

    }


    public void updateItem(String id) {
        this.id = id;
        notifyDataSetChanged();
    }

}